//
//  NSArray+Extension.m
//  DSJY
//
//  Created by 冯华强 on 16/10/22.
//  Copyright © 2016年 dsjy. All rights reserved.
//

#import "NSArray+Extension.h"

@implementation NSArray (Extension)

//数组乱序
- (NSArray *)exchangeObjectList
{
    NSMutableArray *results = [[NSMutableArray alloc] initWithArray:self];
    
    NSInteger count = [results count];
    
    // 循环将倒数第n张牌中的随机一张放到整个扑克的最后
    for(NSInteger n = count-1; n>=0; n--){
        id obj = results[arc4random_uniform(count)];
        [results removeObject:obj];
        [results addObject:obj];
    }
    return results;
}

@end
